import cv2

# 读取图像
image_path = "1.png"
img = cv2.imread(image_path)
img = cv2.resize(img, (200, 250))

time = 1000
# 显示原始图像
cv2.imshow("Original Image (BGR)", img)
cv2.waitKey(time)

# 转换为 RGB
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
cv2.imshow("RGB Image", img_rgb)
cv2.waitKey(time)

# 转换为灰度图像
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.imshow("Grayscale Image", img_gray)
cv2.waitKey(time)

# 转换为 HSV
img_hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
cv2.imshow("HSV Image", img_hsv)
cv2.waitKey(time)

# 转换为 YCrCb
img_ycrcb = cv2.cvtColor(img, cv2.COLOR_BGR2YCrCb)
cv2.imshow("YCrCb Image", img_ycrcb)
cv2.waitKey(time)

# 转换为 HLS
img_hls = cv2.cvtColor(img, cv2.COLOR_BGR2HLS)
cv2.imshow("HLS Image", img_hls)
cv2.waitKey(time)

# 转换为 XYZ
img_xyz = cv2.cvtColor(img, cv2.COLOR_BGR2XYZ)
cv2.imshow("XYZ Image", img_xyz)
cv2.waitKey(time)

# 转换为 LAB
img_lab = cv2.cvtColor(img, cv2.COLOR_BGR2LAB)
cv2.imshow("LAB Image", img_lab)
cv2.waitKey(time)

# 转换为 YUV
img_yuv = cv2.cvtColor(img, cv2.COLOR_BGR2YUV)
cv2.imshow("YUV Image", img_yuv)
cv2.waitKey(time)

# 等待用户按键并关闭所有窗口
cv2.waitKey(time)
cv2.destroyAllWindows()